#include <stdio.h>
#define Q 5 //number of quizes
#define S 5 //number of students
void studentAverages (double q[][Q], double a[]);

int main () {
	int id[S], i, j;
	double q[S][Q], a[S] = {};
	FILE *input;
	input = fopen ("grades.txt","r");
	for (i=0 ; i < S ; i++) {
		fscanf (input,"%d",&id[i]);
		for (j=0 ; j < Q ; j++)
			fscanf (input,"%lf",&q[i][j]);
	}
	fclose(input);
	studentAverages (q, a);
	printf ("\tID\tQuiz Average\n");
	for (i=0 ; i < S ; i++)
		printf ("   %d\t\t%.1lf\n",id[i],a[i]);
	return 0;
}
//=============================
void studentAverages (double q[][Q], double a[]) {
	int i, j;
	for (i=0 ; i < S ; i++) {
		for (j=0 ; j < Q ; j++)
			a[i] += q[i][j];
		a[i] /= Q;
	}
}
